-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add transformItems to all widgets #66
Conversation
Deploy preview for instantsearch-css ready! Built with commit 3339d41 |
content/widgets/search-box.md
Outdated
@@ -144,4 +144,6 @@ options: | |||
- name: autofocus | |||
default: false | |||
description: Focus on the input automatically | |||
- name: transformItems | |||
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is new, but I think it should have it too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no items
so the name transformItems
feels a bit odd. The purpose of it is to transform query so transformQuery
or whatever.
content/widgets/stats.md
Outdated
@@ -11,4 +11,7 @@ classes: | |||
- name: .ais-Stats-text | |||
description: the text of the widget | |||
description: the count of items for each item | |||
options: | |||
- name: transformItems | |||
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not included in IS.js but I think it should have been
content/widgets/clear-refinements.md
Outdated
@@ -27,4 +27,6 @@ options: | |||
- name: clearsQuery | |||
default: false | |||
description: Also clears the query | |||
- name: transformItems | |||
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not included in IS.js but I think it should have been
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's named ClearAll in IS.js for now. We need to implement transformItems
once we rework the widget and name it ClearRefinements.
see also algolia/instantsearch#3042 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about RatingMenu
?
content/widgets/search-box.md
Outdated
@@ -144,4 +144,6 @@ options: | |||
- name: autofocus | |||
default: false | |||
description: Focus on the input automatically | |||
- name: transformItems | |||
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no items
so the name transformItems
feels a bit odd. The purpose of it is to transform query so transformQuery
or whatever.
content/widgets/hits-per-page.md
Outdated
@@ -18,4 +18,6 @@ classes: | |||
options: | |||
- name: items | |||
description: Array of objects with the value, the label and a boolean "default" which decides which item to select by default | |||
- name: transformItems | |||
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: It's a single function
The first sentence is a bit long and it presents 2 aspects: the description itself and the the use case (which is a great idea). I would split it in two.
In the last sentence I'm not sure we should go for return or returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it's not only mapping: mapping, filtering and enhancing the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function which receives the items, which will be called before displaying them. Should return a new array with the same shape as the original array. Useful for mapping over the items to transform, remove or reorder them
content/widgets/search-box.md
Outdated
@@ -144,4 +144,6 @@ options: | |||
- name: autofocus | |||
default: false | |||
description: Focus on the input automatically | |||
- name: transformQuery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep this for a separate proposal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* feat: add transformItems to all widgets * add to ratingMenu * change name * remove searchbox * chore: update text
* feat: add transformItems to all widgets * add to ratingMenu * change name * remove searchbox * chore: update text
* feat: add transformItems to all widgets * add to ratingMenu * change name * remove searchbox * chore: update text
No description provided.